FROM python:3.12-slim
# using 3.12
WORKDIR /app
# using mirror
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PIP_DEFAULT_TIMEOUT=120 \
    PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple \
    PIP_EXTRA_INDEX_URL=https://pypi.org/simple
# cache packages layers
COPY requirements.txt .
RUN pip install -r requirements.txt
# src
COPY app ./app
EXPOSE 8000
CMD [ "python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000" ]
